package fr.enseirbmatmeca.apms.spring.model.project;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.annotations.GenericGenerator;

@Entity
public class UploadedFile {

	/**
	 * 
	 * This class represent a file that has been uploaded or linked
	 * It can be a joint file or a report for example
	 * 
	 * @author coudar
	 *
	 */

	//TODO do a global var in application context to link to root

	private String id;
	private String url; // if starts with http:// it's an absolute URL else it's a relative URL and should start like "/uploadedFiles/RandomPathToAvoidSmartPeopl/myfile.pdf"
	private float size; // size in Ko
	private Date uploadTime;

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(unique = true, nullable = false)
	public String getId() {
		return id;
	}
	@Column(nullable = false)
	public float getSize() {
		return size;
	}
	
	@Column(nullable = false)
	public Date getUploadTime() {
		return uploadTime;
	}
	@Column(nullable = false)
	public String getUrl() {
		return url;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setSize(float size) {
		this.size = size;
	}
	
	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}
	public void setUrl(String url) {
		this.url = url;
	}

}
